p = [-50924.191,24214.648,0]
/*case of
(
(p == undefined): ... -- user pressed escape
(p == #rightClick): ... -- user clicked RMB
(classOf p == Point3): ... -- user entered a point
(classOf p == String): ... -- user keyed a non-point
)*/

imageWidth = 9491
imageHeight = 5294
 
 p.z = -1 * $CenterCam.position.Z
 
 --cameraTransform = inverse $CenterCam.transform
 
-- thePos = p * cameraTransform
 --print thePos
 thePos = p
 
 --[-50776.6,23893.8,-20000]
 
 windowSize = getViewSize()
 print "windowsize"
 print windowSize
  
--screen_origin = mapScreenToView [0,0] (thePos.z) [imageWidth,imageHeight]
screen_origin = [-55969.3,31219.2,-18672.7]
--end_screen = mapScreenToView [imageWidth,imageHeight] (thePos.z) [imageWidth,imageHeight]
end_screen = [55969.3,-31219.2,-18672.7]
world_size = screen_origin-end_screen

x_aspect = imageWidth/(abs world_size.x)
y_aspect = imageHeight/(abs world_size.y)
screen_coords = point2 (x_aspect*(thePos.x-screen_origin.x)) (-(y_aspect*(thePos.y-screen_origin.y)))

--[440.275,552.493]
	print "space"
print screen_coords
